#include <stdio.h>
#include <string.h>
using namespace std;

int isUpperAlpha(char c){  
  if(c >= 'A' && c <= 'Z'){  
    return 1;  
  }  
  return 0;   
}  

void swap(char *a, char *b)
{  
  char temp = *a;  
  *a = *b;  
  *b = temp;  
}   
char * Reorder(char *arr, int len)
{  
  if(arr == NULL || len <= 0)
  {  
    return NULL;  
  }  
  char *p1 = arr;  
  char *p2 = arr;  
  while(p1 < arr + len && p2 < arr + len)
  {  
    while(isUpperAlpha(*p1) )
    {  
      p1++;  
    }  
    while(!isUpperAlpha(*p2) )
    {  
      p2++;  
    }  
    swap(p1, p2);
  }

  return arr;  
} 

void BubbleSort(int arr[], int count)
{
  int i = count, j;
  int temp;

  while(i > 0)
  {
    for(j = 0; j < i - 1; j++)
    {
      if(arr[j] > arr[j + 1])
      {
        temp = arr[j];
        arr[j] = arr[j + 1];
        arr[j + 1] = temp;
      }
    }

    i--;
  }
}

int main(int argc, char const *argv[])
{
  int arr[] = { 5, 4, 1, 3, 6 };
  BubbleSort(arr, 5);
  for(int i = 0; i < 5; i++)
    printf("%2d", arr[i]);
  return 0;
}

